package com.kehutong.crm.message.admin;

import org.coraframework.authz.HasPermission;
import org.coraframework.inject.Inject;
import org.coraframework.json.JSONObject;
import org.coraframework.mvc.MvcAction;
import org.coraframework.mvc.http.Bean;
import org.coraframework.mvc.http.ReqMapping;
import org.coraframework.mvc.http.result.Result;
import com.kehutong.crm.message.entity.MessageTemplateInner;
import com.kehutong.crm.message.service.MessageInnerService;

/**
 * 管理后台-消息管理-站内信模板管理
 */
@MvcAction
@ReqMapping("/admin/crm/message/inner")
public class MessageInnerController {

    @Inject
    private MessageInnerService messageInnerService;

    @HasPermission("crm:message:inner:view")
    @ReqMapping("/list/page")
    public Object listPage(JSONObject jsonObject) {
        return messageInnerService.listPage(jsonObject);
    }

    @HasPermission("crm:message:inner:add")
    @Bean(newInstance=true, copy=true)
    @ReqMapping("/save")
    public Object save(MessageTemplateInner inner) {
        return messageInnerService.save(inner);
    }

    @HasPermission("crm:message:inner:edit")
    @Bean(copy=true)
    @ReqMapping("/update")
    public Object update(MessageTemplateInner inner) {
        return messageInnerService.update(inner);
    }

    @HasPermission("crm:message:inner:del")
    @ReqMapping("/delete")
    public Object delete(MessageTemplateInner inner) {
        return messageInnerService.delete(inner);
    }

    @ReqMapping("/get")
    public Object get(MessageTemplateInner inner) {
        return Result.success(inner);
    }
}
